<?php
/*
 * Shop online & eStore
 *
 * Author: mr.Trieu
 * Created: 22-11-2011
 * $shop.php
 *
 * */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

if(empty($_G['shop']['sid']) || $_G['shop']['type'] == 'group') {
	showmessage('shop_nonexistence');
}

if(($special == 1 && !$_G['group']['allowpostpoll']) || ($special == 2 && !$_G['group']['allowposttrade']) || ($special == 3 && !$_G['group']['allowpostreward']) || ($special == 4 && !$_G['group']['allowpostactivity']) || ($special == 5 && !$_G['group']['allowpostdebate'])) {
	showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}

if(empty($_G['shop']['allowpost'])) {
	if(!$_G['shop']['postperm'] && !$_G['group']['allowpost']) {
		showmessage('postperm_none_nopermission', NULL, array(), array('login' => 1));
	} elseif($_G['shop']['postperm'] && !forumperm($_G['shop']['postperm'])) {
		showmessagenoperm('postperm', $_G['sid'], $_G['shop']['formulaperm']);
	}
} elseif($_G['shop']['allowpost'] == -1) {
	showmessage('post_forum_newthread_nopermission', NULL);
}

if(!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
	showmessage('postperm_login_nopermission', NULL, array(), array('login' => 1));
}

checklowerlimit('post', 0, 1, $_G['shop']['sid']);

if(!submitcheck('productsubmit', 0, $seccodecheck, $secqaacheck)) {

	include template('shop/post');
}else{
	echo $_G['gp_subject'];
}